package io.xxx.xbutler.domain;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import io.xxx.xbutler.domain.task.ReceiverType;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.ArrayTypeHandler;

import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
public class Message {

    @TableId
    private String id;

    private String serialNo;

    private Long num;

    private String talkerId;

    private String talkerSerialNo;

    private String talkerName;

    private ReceiverType receiverType;

    private String receiverId;

    private String receiverSerialNo;

    private Integer messageType;

    private String content;

    private String xmlContent;

    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private JSONObject referenceMessageBody;

    private Integer voiceTime;

    private String shareTitle;

    private String shareDescription;

    private String shareUrl;

    private LocalDateTime sendTime;

    /**
     * 区别用户发言还是机器人发言，
     * 10：普通人
     * 12：机器人
     */
    private Integer platformMessageType;

    private String realSerialNo;

    private String downFileSerialNo;

    @TableField(typeHandler = ArrayTypeHandler.class)
    private String[] atInRoom;

    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private JSONArray files;

    private LocalDateTime createdTime;
}
